<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表渲染</title>
    <script src="../vue2.js"></script>
    <style>
        ul, li {
            list-style: none;
        }
    </style>
</head>
<body>
<div id="box">
    //对数组遍历
    <ul>
        <li v-for="(item,index) of datalist">   <!--关键字可以是in，也可以是of-->
            {{item}}-{{index}}
        </li>
    </ul>

    //对对象遍历
    <ul>
        <li v-for="(item,key) of obj">
            {{key}}-{{item}}
        </li>
    </ul>

    //对数字遍历，伪造假数据
    <ul>
        <li v-for="item in 10">
            {{item}}
        </li>
    </ul>
</div>
<script>
    let vm = new Vue({
        el: "#box",
        data: {
            datalist: ['111', '222', '333'],
            obj: {
                name: '最爱吃兽奶',
                age: 18,
                gender: '男',
            }
        }
    })
</script>
</body>
</html>